package com.xinxuan.usercenter.rocketmq;

import javax.annotation.Resource;

import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.stereotype.Service;

import com.xinxuan.usercenter.dto.UserAddBonusDTO;
import com.xinxuan.usercenter.service.UserService;

import lombok.extern.slf4j.Slf4j;

/**
 * @author xinsl
 * @date 2021/12/13
 */
@Service
@Slf4j
public class AddBonusStreamConsumer {
    @Resource
    private UserService userService;

    @StreamListener(Sink.INPUT)
    public void receice(UserAddBonusDTO message) {
        message.setEvent("CONTRIBUTE");
        message.setDescription("投稿加积分。。。。");
        userService.addBonus(message);
    }

}
